package com.baizhi.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyMethodInterceptor  {
    @Around("execution(* com.baizhi.service.*.*(..))")
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        long l = System.currentTimeMillis();
        System.out.println("前置通知的时间"+l);
        Object proceed = joinPoint.proceed();//执行方法
        long time = System.currentTimeMillis();
        System.out.println("后置通知的时间"+time);
        long time2=time-l;
        System.out.println("时间"+time2);
        return proceed;
    }
}
